<template>
	<!--电卡管理-->
	<view class="margin-top-sm">
		<view class="margin-left-xs" style="border-radius: 10rpx;">
			<view class="bg-img nbys">
				<view class="text-white padding-left-xl padding-top-xl">
					￥<text class="text-xxl text-bold text-white" style="font-size:60rpx;">{{balance}}</text>
					<view style="color: #AFD7FF;">电卡余额</view>
				</view>
				<view v-if="isshow" class="text-white padding-left-xl text-xxl text-red">
					未绑定
				</view>
				<view v-else class="text-white padding-left-xl text-xxl">
					{{no}}
				</view>
			</view>
		</view>
		<view class="solid-bottom margin-top-sm padding-sm" @tap="torecharge">
			<view class="padding-left-lg padding-bottom-sm">
				<image src="../../../common/img/chongzhi.png" style="width:50rpx;height: 50rpx;vertical-align: middle;"></image>
				<text class="margin-left-sm" style="vertical-align: middle;">电卡充值</text>
			</view>
		</view>
		<view class="solid-bottom margin-top-sm padding-sm" @tap="todkbd">
			<view class="padding-left-lg padding-bottom-sm">
				<image src="../../../common/img/bangding.png" style="width:50rpx;height: 50rpx;vertical-align: middle;"></image>
				<text class="margin-left-sm" style="vertical-align: middle;">电卡绑定</text>
			</view>
		</view>
		<view class="solid-bottom margin-top-sm padding-sm" @tap="tocardinfo">
			<view class="padding-left-lg padding-bottom-sm">
				<image src="../../../common/img/bangding.png" style="width:50rpx;height: 50rpx;vertical-align: middle;"></image>
				<text class="margin-left-sm" style="vertical-align: middle;">电卡使用情况</text>
			</view>
		</view>
	</view>
</template>

<script>
export default {
		data() {
			return {
				no:"",
				balance:"",
				isshow:false
			};
		},
		onLoad(options){
			this.balance=options.balance;
		},
		onShow() {
			this.getdata();
		},
		methods: {
			getdata(){
				let that=this;
				that.http.tokenreq({
					url: 'card/v1/getcardinfo',
				}).then((res) => {
					let e=res.data;
					if(e.code==0 && e.success){
					   that.no = e.data.card_no;
					}else if(e.code==-1){
						that.isshow=true;
					}
				})
				
			},
			//电卡充值
			torecharge(){
				uni.navigateTo({
					url: '/pages/user/eleccard/dkcz?no='+this.no
				})
			},
			//电卡绑定
			todkbd(){
				uni.navigateTo({
					url: '/pages/user/eleccard/dkbd?no='+this.no
				})
			},
			//电卡使用情况
			tocardinfo(){
				uni.navigateTo({
					url: '/pages/user/eleccard/carduseinfo?no='+this.no+'&balance='+this.balance
				})
			}	
		}
	}
</script>


<style>
	page{
		background-color: #FFFFFF;
	}
	.nbys{
		background-image:url(../../../common/img/dianka.png);
		background-size: 100% 100%;
		width: 100%;
		height:344rpx;
	}
</style>
